<script setup lang="ts">
import { useRandomTestingStore } from '@/pages/RandomTesting/store'

const rootStore = useRandomTestingStore()
const { plainStore } = rootStore
const {
  disabledPre,
  disabledShowAnswer,
  disabledNext,
  loading,
  showAnswer,
  onToggleShowAnswer,
  onClickPre,
  onClickNext,
} = plainStore
</script>

<template>
  <div class="footer-placehold"></div>
  <div class="footer-box">
    <div class="drag-bar-box">
      <div class="drag-bar"></div>
    </div>
    <div class="footer-inner">
      <AButton :disabled="disabledPre || loading" @click="onClickPre"> 上一题 </AButton>
      <AButton
        :disabled="disabledShowAnswer || loading"
        class="block-btn"
        block
        @click="onToggleShowAnswer"
      >
        {{ showAnswer ? '隐藏答案' : '查看答案' }}
      </AButton>
      <AButton :disabled="disabledNext || loading" @click="onClickNext"> 下一题 </AButton>
    </div>
  </div>
</template>

<style scoped>
.footer-placehold {
  height: 60px;
  flex: none;
}
.footer-box {
  .drag-bar-box {
    text-align: center;
    .drag-bar {
      height: 8px;
      width: 128px;
      background-color: #434343;
      border-radius: 8px;
    }
  }
  position: absolute;
  bottom: 0;
  width: 100%;

  :deep(.ant-progress) {
    margin: 0;
    box-sizing: border-box;
  }

  .footer-inner {
    box-sizing: border-box;
    width: 100%;
    padding: 8px;
    overflow: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;

    .block-btn {
      margin: 0 8px;
    }
  }
}
</style>
